package com.sicnu.startup.controller;

import com.sicnu.startup.result.Result;
import com.sicnu.startup.service.OssService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author zr
 */
@RestController
@RequestMapping("/project/oss/file")
@CrossOrigin
public class OssController {
    @Resource
    private OssService ossService;

    @PostMapping("fileUpload")
    public Result uploadOssFiles(MultipartFile file) {
        String url = ossService.uploadFileAvatar(file);
        return Result.ok(url);
    }
}
